//
//  SXBarrageManager.m
//  DOUYU
//
//  Created by 沈欣 on 2017/11/23.
//  Copyright © 2017年 沈欣. All rights reserved.
//

#import "SXBarrageManager.h"
#import <CocoaLumberjack/CocoaLumberjack.h>

@implementation SXBarrageManager

//定义日志级别
static const DDLogLevel ddLogLevel = DDLogLevelVerbose;

+ (SXBarrageManager *)sharedInstance{
    static SXBarrageManager *__instance__;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        __instance__ = [[SXBarrageManager alloc]init];
    });
    return __instance__;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        //初始化日志系统
        //设置终端输出
        [[DDLog sharedInstance] addLogger:[DDTTYLogger sharedInstance]];
        
        //定义日志文件输出
        NSString *logPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingString:@"/logs"];
        //创建日志文件管理对象
        DDLogFileManagerDefault *logFileMgr = [[DDLogFileManagerDefault alloc] initWithLogsDirectory:logPath];
        //创建文件日志输出对象
        DDFileLogger *fileLogger = [[DDFileLogger alloc] initWithLogFileManager:logFileMgr];
        //添加到日志管理对象中
        [[DDLog sharedInstance] addLogger:fileLogger];
    }
    return self;
}

/**
 加入房间
 
 @param roomId 房间号
 */
- (void)joinRoomWithRoomId:(NSString *)roomId{
    DDLogInfo(@"进入房间:%@",roomId);
}

/**
 退出房间
 */
- (void)exitRoom{
    DDLogInfo(@"退出房间");
}


@end
